package com.imy.lua.lib.log;

import com.immomo.mls.annotation.LuaBridge;
import com.immomo.mls.annotation.LuaClass;
import com.imy.common.util.ALog;
import com.imy.lua.view.floating.FloatingManger;

import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue;

/**
 * @ProjectName: LuaScript
 * @Package: com.imy.lua.lib.log
 * @ClassName: UDLog
 * @Description: 描述
 * @Author: Imy
 * @CreateDate: 2021/4/19 10:15
 */
@LuaClass
public class UDLog {

  public static final String LUA_CLASS_NAME = "Log";
  protected Globals globals;

  public UDLog(Globals globals, LuaValue[] init) {
    this.globals = globals;
    //构造函数
  }

  public void __onLuaGc() {
    globals = null;
  }

  @LuaBridge
  public void i(String tag, String msg) {
    ALog.i(tag,msg);
    FloatingManger.get().getFloatingView().getConsoleView().addLog(msg);
  }

}